package cn.edu.hnpu.news.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import cn.edu.hnpu.news.R;
import cn.edu.hnpu.news.ui.widget.GestureFrameLayout;

public class QueryKuaidiActivity extends BaseActivity {

    private static final String APP_REQUEST_BASEURL = "http://m.kuaidi100.com/index_all.html";
    private static final String APP_CACAHE_DIRNAME = "/webcache";
    private Toolbar mToolbar;
    private GestureFrameLayout mGestureFrameLayout;  //滑动返回
    private EditText yundan_num;
    private EditText kuaidi_name;
    private Button query_btn;
    private String mYunDanNum;
    private String mKuaidiName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_query_kuaidi);

        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_black);
        setSupportActionBar(mToolbar);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                QueryKuaidiActivity.this.finish();
            }
        });

        mGestureFrameLayout = (GestureFrameLayout) findViewById(R.id.about_gesture_layout);
        mGestureFrameLayout.attachToActivity(this);

        yundan_num = (EditText) findViewById(R.id.yundan_num);
        kuaidi_name = (EditText) findViewById(R.id.kuaidi_name);
        query_btn = (Button) findViewById(R.id.query_btn);

        query_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mYunDanNum = yundan_num.getText().toString().trim();
                mKuaidiName = kuaidi_name.getText().toString().trim();
                String loadUrl = APP_REQUEST_BASEURL+"?type=" + mKuaidiName
                        + "&postid=" + mYunDanNum + "&callbackurl=test://back";
                Intent intent = new Intent(QueryKuaidiActivity.this, KuaidiActivity.class);
                intent.putExtra("detailUrl", loadUrl);
                startActivity(intent);
            }
        });

    }


}
